package cn.edu.ujn.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.ujn.dao.Customer;
import cn.edu.ujn.dao.CustomerMapper;
import cn.edu.ujn.dao.User;
@Service
@Transactional
public class CustomerServiceImpl implements ICustomerService {
     
	@Autowired
	private CustomerMapper customermapper;
	
	@Override
	public Customer selectCustomer(Integer custId) {
		// TODO Auto-generated method stub
		 Customer customer = customermapper.selectByPrimaryKey(custId);
			return customer;
	}

	@Override
	public int addCustomer(Customer customer) {
		// TODO Auto-generated method stub
		int insert = customermapper.insert(customer);
		return insert;
	}

	@Override
	public int deleteCustomer(Integer id) {
		int deleteByPrimaryKey = customermapper.deleteByPrimaryKey(id);
		return deleteByPrimaryKey;
	}

	@Override
	public int updateCustomer(Customer customer) {
		int updateByPrimaryKey = customermapper.updateByPrimaryKey(customer);
		return updateByPrimaryKey;
	}

	@Override
	public List<Customer> findAllCustomer() {
		List<Customer> findAllCustomer = customermapper.findAllCustomer();
		return findAllCustomer;
	}

	@Override
	public List<Customer> findCustomerByType(Integer custId, String custName, String custAddress,
			String custIndustry, String custSource) {
		List<Customer> findCustomerByType = customermapper.findCustomerByType(custId, custName, custAddress,custIndustry, custSource);
		return findCustomerByType;
	}

}
